package cn.trasen.his.poc.std.api.model.drug;

import cn.trasen.his.poc.std.api.emums.DrugTypeEnum;
import cn.trasen.his.poc.std.api.emums.MedicTypeEnum;
import cn.trasen.his.poc.std.api.model.major.OrgInfo;
import pro.shushi.pamirs.boot.base.ux.annotation.field.UxWidget;
import pro.shushi.pamirs.boot.base.ux.annotation.view.UxForm;
import pro.shushi.pamirs.boot.base.ux.annotation.view.UxTableSearch;
import pro.shushi.pamirs.meta.annotation.Field;
import pro.shushi.pamirs.meta.annotation.Model;
import pro.shushi.pamirs.meta.base.IdModel;

import java.math.BigDecimal;
import java.util.List;

import static pro.shushi.pamirs.meta.annotation.Field.serialize.COMMA;

/**
 * @Description: 药品字典
 * @author: Jacob
 * @Date: 2024-11-26 14:47:02
 * @Company: 湖南创星科技股份有限公司
 */
@Model.model(DrugDictionary.MODEL_MODEL)
@Model(displayName = "处方字典", labelFields = "drugName")
public class DrugDictionary extends IdModel {

    private static final long serialVersionUID = -1L;

    public static final String MODEL_MODEL = "ts.his.DrugDictionary";

    @Field.many2one
    @Field.Relation(relationFields = {"orgCode"}, referenceFields = {"code"})
    @Field(displayName = "机构", required = true)
    private OrgInfo org;

    @Field.String
    @Field(displayName = "机构代码", invisible = true)
    private String orgCode;

    @UxTableSearch.FieldWidget(@UxWidget())
    @Field(displayName = "药品名称", required = true)
    private String drugName;

    @Field.many2one
    @Field.Relation(relationFields = {"factId"}, referenceFields = {"id"})
    @Field(displayName = "生产厂家", required = true)
    private DrugFactory fact;

    @Field.Integer
    @Field(displayName = "生产厂家ID", invisible = true)
    private Long factId;

    @Field.Money(M = 11, D = 2)
    @Field(displayName = "进货价(元)", required = true)
    private BigDecimal buyPrice;

    @Field.Money(M = 11, D = 2)
    @Field(displayName = "零售价(元)", required = true)
    private BigDecimal selPrice;

    @Field(displayName = "药品规格", required = true)
    private String specsDesc;

    @Field.many2one
    @Field.Relation(relationFields = {"unitCode"}, referenceFields = {"unitCode"})
    @Field(displayName = "单位", required = true)
    private DrugUnit unit;

    @Field.String
    @Field(displayName = "单位编码", invisible = true)
    private String unitCode;

    @UxTableSearch.FieldWidget(@UxWidget())
    @Field.Enum
    @Field(displayName = "药品类型", required = true)
    private DrugTypeEnum drugType;

    @Field.String
    @Field(displayName = "属性标识", multi = true, serialize = COMMA)
    private List<String> labels;

    @Field.String
    @UxForm.FieldWidget(@UxWidget(invisible = "activeRecord.drugType!='WESTERN_MEDICINE'"))
    @Field(displayName = "高危属性标识", multi = true, serialize = COMMA)
    private List<String> riskLabels;

    @Field.Enum
    @Field(displayName = "医保类型")
    private MedicTypeEnum medicType;

    @Field(displayName = "医保名称")
    private String insuranceName;

    @Field(displayName = "医保编码")
    private String insuranceCode;

    @Field.String(size = 512)
    @Field(displayName = "医保限制病种")
    private String insuranceRestrictedDisease;

}